import Platform from 'Platform'
import { PixelRatio } from 'react-native'
import { StackNavigator, TabNavigator } from 'react-navigation'
import { ifIphoneX } from 'react-native-iphone-x-helper'

import Home from '../containers/Home'
import Anime from '../containers/Anime'

let tabBarOptions = {
    style: {
      ...ifIphoneX({
          height: 75,
          backgroundColor:'#f60',
          paddingBottom: 25,
      }, {
          backgroundColor:'#f60',
      })
    },
    activeTintColor:'#08f',
    inactiveTintColor:'#757575',
  }
  
  if (Platform.OS === 'android') {
  
    tabBarOptions = {
      style: {
        height: 50,
        backgroundColor:'#fff'
      },
      tabStyle:{
        borderWidth: 0,
      },
      activeTintColor:'#08f',
      inactiveTintColor:'#757575',
  
      showIcon: true,
      showLabel: true,
      iconStyle: { width:28, height:28 },
      labelStyle:{ fontSize: 9, marginTop:0 },
      indicatorStyle: { backgroundColor: '#fff' }
    }
  
  }
  
  const MainScreenNavigator = TabNavigator({
    Home: { screen: Home },
    // Topics: { screen: Topics },
    // Notifications: { screen: Notifications },
    // Me: { screen: Me }
  },
  {
    initialRouteName: 'Home',
    tabBarPosition: 'bottom',
    swipeEnabled:false,
    animationEnabled:false,
    lazy: true,
    tabBarOptions: tabBarOptions
  })
  
  const App = StackNavigator({
    Main: { screen: MainScreenNavigator },
    Anime: { screen: Anime },
  },{
    initialRouteName: 'Anime',
    navigationOptions: {
      headerTruncatedBackTitle: '返回',
      headerBackTitle: null,
      headerStyle: {
        backgroundColor: '#fff',
        ...ifIphoneX({
          paddingTop:30,
          height: 75,
        }, {
          height: Platform.OS === 'android' ? 50 : 65
        })
      },
      headerTintColor: '#f60',
      headerTitleStyle: {
        fontSize: 17,
        color:'#f60'
      },
      headerBackTitleStyle: {
        backgroundColor: '#333'
      },
      headerBackTitleStyle: {
        fontSize:17
      }
    },
    headerMode: 'screen'
  })
  
  export default App  